//设置在调用处
// timePickerIsShow: false,
//   timestr:'',
//     year: date.getFullYear(),
//       month: date.getMonth() + 1,
//         day: date.getDate(),
//           time: date.getHours() + 1,
//             //滑动框中放入的是第几个值
//             value: [date.getFullYear(), date.getMonth(), date.getDate() - 1, date.getHours()],
function init() {
  var that = this;

  const date = new Date()
  const years = []
  const months = []
  const days = []
  const times = []
  for (let i = 1950; i <= date.getFullYear(); i++) {
    years.push(i)
  }
  for (let i = 1; i <= 12; i++) {
    months.push(i)
  }
  for (let i = 1; i <= 31; i++) {
    days.push(i)
  }
  for (let i = 1; i <= 24; i++) {
    times.push(i)
  }
  //设置默认数组
  that.setData({
    year:years,
    month:months,
    day:days,
    time:times
  })
  // 点击选择取消按钮
  that.timeCancel = function (e) {
    this.setData({
      timePickerIsShow:false
    })
  }
  // 点击选择确定按钮
  that.timeSure = function (e) {
    let value = that.data.value
    let info = `${years[value[0]]}-${months[value[1]]}-${days[value[2]]}`
    that.setData({
      timestr: info,
      timePickerIsShow: false
    })
  },
  
  // 处理选择滚动
    that.timeChange = function (e) {
    //console.log(e)
    var value = e.detail.value
    that.setData({
      value: value,
    })
    
  }

  that.clickimg = function(){
    console.log("click-img...")
  }
  
};
module.exports = {
  init: init
};